<template>
  <a-config-provider :auto-insert-space-in-button="false" :locale="zh_CN">
    <div id="app">
    <!--<router-view  v-if="!$route.meta.keepAlive"></router-view>
    <keep-alive>
      <router-view  v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    -->
    <router-view></router-view>
    </div>
  </a-config-provider>
</template>
<script>
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
import {mapGetters} from 'vuex'
import copyACtion from '@/views/singleProject/fileSingle/el-common-js/copy'
export default {
  name: 'App',
  data() {
    return {
      zh_CN,
      locale: {}
    }
  },
  mixins: [copyACtion],
  created() {
    // this.changeLang('zh')
    // setTimeout(() => {
    //   this.changeLang('en')
    // }, 5000)
  },
  computed: {
    ...mapGetters({
      'fileSingleData': 'fileSingle'
    })
  },
  watch: {
    $route(to,from){
      // console.log(this.$route.query.newWin)
      if(this.$route.query.newWin){
        sessionStorage.setItem("fromRouteName", "projectList")
        if(this.$route.query.oid && this.$route.query.projectObj){
          let projectObj = this.$route.query.projectObj
          sessionStorage.setItem("oid",this.$route.query.oid)
          sessionStorage.setItem("ProjectObj",projectObj)
        }
        if (this.$route.query.type === '软件开发项目') {
          sessionStorage.setItem("projectSmallType", JSON.parse(projectObj).projectType)
        }
        if(this.$route.query.reviewId){
          sessionStorage.setItem("reviewId",this.$route.query.reviewId)
        }
        if(this.$route.query.planOid && this.$route.query.planType){
          const param = {
            oid: this.$route.query.planOid,
            type: this.$route.query.planType
          }
          if(this.$route.query.planType.indexOf("产品") > -1 || this.$route.query.planType.indexOf("技术") > -1) {
            sessionStorage.setItem("bookDetailParam", JOSN.stringify(param))
          }else{
            sessionStorage.setItem("bookDetailParamGroup", JOSN.stringify(param))
          }
          
        }
        if(this.$route.query.doneList){
          let doneList = this.$route.query.doneList
          sessionStorage.setItem('doneListInfo', doneList)
        }
        // let tabArr = JSON.parse(sessionStorage.getItem('tabArr'))
        let tabArr = []
        tabArr.push({
          key: 1,
          path: this.$route.path,
          title: this.$route.query.title
        })
        this.$store.commit("SET_TABS", tabArr); // 赋值
        // 跳转到查看交付物页面
        if(this.$route.query.fileRecord) {
          let fileRecord = JSON.parse(this.$route.query.fileRecord)
        
          this.fileSingleData.tableArr = [fileRecord]
          this.setFileSingle(this.fileSingleData)
          this.setFileSingleTableItem({oid: fileRecord.oid, state: fileRecord.state})
          this.$store.commit('SET_PROJECT_FILE_TITLE', '')
          // this.$router.push({path: "/single/fileSingle"})
        }
        
        let path = {
          path: this.$route.path,
        }
        // /examineProject?to=sigleFile
        if(this.$route.query.to) {
          path.query = {to: this.$route.query.to}
        }
        this.$router.push(path)
      }
     
    }
  },
  mounted() {
    // console.log(this.$route.query.newWin)
  },
  methods: {
    changeLang(lang) {
      this.$i18n.locale = lang
      switch (lang) {
        case 'zh':
          this.locale = require('ant-design-vue/es/locale-provider/zh_CN').default
          break
        // case 'HK':
        //   this.locale = require('ant-design-vue/es/locale-provider/zh_TW').default
        //   break
        case 'en':
        default:
          this.locale = require('ant-design-vue/es/locale-provider/en_US').default
      }
    },
  }
}
</script>
<style>
#app {
  /* font-family: 'Microsoft YaHei'; */
  /* font-family: 'PingFang SC' !important; */
  font-family: 'PingFang-SC-Regular', 'PingFang SC', sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-size: 100% 100%;
  /* user-select: none; */
}
html, body, #app {
  /* height: 100%; */
  height: 100vh;
}
</style>